BINNAME = edit-sfs
PKGNAME = edit_sfs
ROXAPPNAME = Edit-SFS

VERSION = 2.0

PREFIX = /usr
BINDIR = $(PREFIX)/bin
DESKTOPDIR = /usr/share/applications
DEKTOPFILE = $(PKGNAME).desktop
ROXAPPDIR = /root/my-roxapps

PKGDIR_NOVER = $(PKGNAME)-
PKGDIR = $(PKGDIR_NOVER)$(VERSION)
TGZEXTENSION = .tar.gz
TGZNAME = $(PKGDIR)$(TGZEXTENSION)
PETEXTENSION = .pet
PETNAME = $(PKGDIR)$(PETEXTENSION)


all: edit-sfs

edit-sfs: AppInfo.xml AppRun.sh dot.DirIcon $(DEKTOPFILE)
	rm -rf $(ROXAPPNAME)
	mkdir -p $(ROXAPPNAME)
	cp AppInfo.xml $(ROXAPPNAME)/AppInfo.xml
	cp AppRun.sh $(ROXAPPNAME)/AppRun
	cp dot.DirIcon $(ROXAPPNAME)/.DirIcon

dir: all
	rm -rf $(PKGDIR)
	mkdir -p $(PKGDIR)/$(BINDIR) $(PKGDIR)/$(ROXAPPDIR) $(PKGDIR)/$(DESKTOPDIR)
	cp -a $(ROXAPPNAME) $(PKGDIR)/$(ROXAPPDIR)/$(ROXAPPNAME)
	cp -a $(DEKTOPFILE) $(PKGDIR)/$(DESKTOPDIR)
	ln -s $(ROXAPPDIR)/$(ROXAPPNAME)/AppRun $(PKGDIR)/$(BINDIR)/$(BINNAME)
	
tgz: dir
	rm -f $(TGZNAME)
	tar czf $(TGZNAME) $(PKGDIR)
	
pet: tgz
	rm -f $(PETNAME)
	tgz2pet $(TGZNAME)

clean:
	rm -rf $(PKGDIR_NOVER)*
	rm -f *$(TGZEXTENSION) *$(PETEXTENSION)
	rm -rf $(ROXAPPNAME)

install: all
	mkdir -p $(BINDIR) $(ROXAPPDIR) $(DESKTOPDIR)
	cp -a $(ROXAPPNAME) $(ROXAPPDIR)/$(ROXAPPNAME)
	cp -a $(DEKTOPFILE) $(DESKTOPDIR)/$(DEKTOPFILE)
	ln -s $(ROXAPPDIR)/$(ROXAPPNAME)/AppRun $(BINDIR)/$(BINNAME)

uninstall: 
	rm -f $(DESKTOPDIR)/$(DEKTOPFILE)
	rm -f $(BINDIR)/$(BINNAME)
	rm -rf $(ROXAPPDIR)/$(ROXAPPNAME)

